<?php

class Follow_IndexController extends Ac_Controller_Action
{
    public function indexAction() 
    {
    	
    }   
	
	public function followAction(){
		$id = $this->_request->getParam('id');
		
		$follow = Model_Follow::follow(new MongoId($id));
		if($follow !== false){
            $this->_helper->json(array('result' => $follow));
        } else {
            $this->_helper->json(array('result' => -1));
		}
		exit;
	}
	
    public function unfollowAction()
    {
		$user = $this->_request->getParam('id');
		
		$unfollow = Model_Follow::unfollow(new MongoId($user));
        if ($unfollow !== false) {
            $this->_helper->json(array('result' => $unfollow));
        } else {
            $this->_helper->json(array('result' => -1));
		}
		exit;
    }

    public function likeAction()
    {
		$id = $this->_request->getParam('id');
		$follow = Model_Like::like(new MongoId($id));
		
        if ($follow !== false) {
            $this->_helper->json(array('result' => $follow));
        } else {
            $this->_helper->json(array('result' => -1));
		}
		exit;
	}
	
	public function unlikeAction(){
		$id = $this->_request->getParam('id');
		
		$unlike = Model_Like::unlike(new MongoId($id));
	    if ($unlike !== false) {
            $this->_helper->json(array('result' => $unlike));
        } else {
            $this->_helper->json(array('result' => -1));
		}
	
		exit;
	}
}
